package cn.iocoder.yudao.module.ai.dal.mysql.operationalarm;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.operationalarm.OperationAlarmDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ai.controller.admin.operationalarm.vo.*;

/**
 * 运营中心-报警信息 Mapper
 *
 * @author 侯俊青
 */
@Mapper
public interface OperationAlarmMapper extends BaseMapperX<OperationAlarmDO> {

    default PageResult<OperationAlarmDO> selectPage(OperationAlarmPageReqVO reqVO) {

        return selectPage(reqVO, new LambdaQueryWrapperX<OperationAlarmDO>()
                .eqIfPresent(OperationAlarmDO::getFromMessageId, reqVO.getFromMessageId())
                .eqIfPresent(OperationAlarmDO::getFromMessageIndex, reqVO.getFromMessageIndex())
                .inIfPresent(OperationAlarmDO::getCompanyId, reqVO.getCompanyIds())
                .eqIfPresent(OperationAlarmDO::getAlarmId, reqVO.getAlarmId())
                .eqIfPresent(OperationAlarmDO::getAlarmLevel, reqVO.getAlarmLevel())
                .likeIfPresent(OperationAlarmDO::getAlarmType, reqVO.getAlarmType())
                .eqIfPresent(OperationAlarmDO::getAlarmDesc, reqVO.getAlarmDesc())
                .eqIfPresent(OperationAlarmDO::getEquipmentLocation, reqVO.getEquipmentLocation())
                .betweenIfPresent(OperationAlarmDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(OperationAlarmDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(OperationAlarmDO::getAlarmEvidence, reqVO.getAlarmEvidence())
                .eqIfPresent(OperationAlarmDO::getLogStr, reqVO.getLogStr())
                .eqIfPresent(OperationAlarmDO::getHandleStatus, reqVO.getHandleStatus())
                .eqIfPresent(OperationAlarmDO::getErrorCode, reqVO.getErrorCode())
                .eqIfPresent(OperationAlarmDO::getRelativeParams, reqVO.getRelativeParams())
                .betweenIfPresent(OperationAlarmDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OperationAlarmDO::getSuplierId, reqVO.getSuplierId())
                .orderByDesc(OperationAlarmDO::getId));
    }

}